devnum2devname() returns pointer to memory allocated with strdup.
It must be released to prevent memory leak.
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski [at] intel.com>
---
util.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/util.c b/util.c
index d292a66..423b66f 100644
--- a/util.c
+++ b/util.c
[at] [at] -1502,7 +1502,11 [at] [at] int mdmon_pid(int devnum)
char pid[10];
int fd;
int n;
- sprintf(path, "%s/%s.pid", pid_dir, devnum2devname(devnum));
+ char *devname = devnum2devname(devnum);
+
+ sprintf(path, "%s/%s.pid", pid_dir, devname);
+ free(devname);
+
fd = open(path, O_RDONLY | O_NOATIME, 0);
if (fd < 0)
--
1.6.4.2
--
Best Regards,
Przemyslaw Hawrylewicz-Czarnowski
Software Development Engineer
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
